var log4js = require('log4js');
var cors = require('cors')
var logger = log4js.getLogger("data-api");
logger.level = "info"; // default level is OFF - which means no logs at all.
const express = require('express');
const bodyParser = require('body-parser'); // 导入body-parser模块
const multer = require('multer');
const select = require("./select.js");
const app = express();

//设置跨域访问（设置在所有的请求前面即可）
app.use(cors())

// 使用body-parser中间件来解析POST请求的参数
app.use(bodyParser.urlencoded({ extended: false }));


// 配置 multer 中间件
const upload = multer();

app.get('/test', upload.any(),async (req, res) => {
  try {
    let data={"say:":"hi"};
    res.send(data);
  } catch (error) {
  }
})


app.post('/api/v1/user/runes', upload.any(),async (req, res) => {
  try {
    let data={"count":0,"data":[],"page":1,"size":38,"status":10000};
    res.send(data);
  } catch (error) {
  }
})

app.post('/api/v1/pook/stats', upload.any(),async (req, res) => {
  try {
    let data={"data":{"tick":"kevin","number":842,"precision":0,"progress":756648,"holders":21414,"trxs":7543279,"created_at":1702896527,"completed_at":0,"minter":"0x2d6a1471317523e6052487cD7b41916152e2f9CD","deploy_block":51268782,"display":true,"sequence":99,"max":"10240000000","limit":"1000","minted":"7543279000"},"status":10000};
    res.send(data);
  } catch (error) {
  }
})

app.listen(2023, () => {
	logger.info("数据接口开启，端口:2023");
});
